package com.swak.frame.excel.validation;


import com.swak.frame.excel.metadata.ExcelRow;
import com.swak.frame.validation.ValidationResult;
import com.swak.frame.validation.ValidatorUtils;

public class BeanDataValidator<T extends ExcelRow> implements RowDataValidator {

	private Class<?>[] groups;

	public BeanDataValidator(Class<?>[] groups) {
		this.groups = groups;
	}

	public static <T> BeanDataValidator<ExcelRow> newDataValidator(Class<?>[] groups) {
		return new BeanDataValidator<ExcelRow>(groups);
	}

	@Override
	public ValidationResult validate(ExcelRow data) {
		return ValidatorUtils.warpValidate(data, groups);
	}
}
